package cn.team11.smarteye.impl;

import cn.team11.smarteye.contract.DevicesListContract;
import cn.team11.smarteye.module.MyDaoManager;
import cn.team11.smarteye.service.CatEyeService;

/**
 * Created by Yang on 2017/10/29.
 *
 * 获取设备列表
 */

public class DevicesListPresenterImpl implements DevicesListContract.Presenter {

    private DevicesListContract.View mView;

    public DevicesListPresenterImpl(DevicesListContract.View mView) {
        this.mView = mView;
        mView.setPresenter(this);
    }

    @Override
    public void start() {

    }

    @Override
    public void destroy() {

    }

    @Override
    public void getMyDevices() {
        //执行sdk来获取设备列表
        if (CatEyeService.icvss != null){
            CatEyeService.icvss.equesGetDeviceList();
        }
    }

    @Override
    public void deleteDevice(String bid) {
        if (CatEyeService.icvss != null){
            CatEyeService.icvss.equesDelDevice(bid);
            //删除数据库
            MyDaoManager.getInstance(mView.getContext()).deleteCateyeInfo(bid);
        }
    }
}
